Public Class ValidateError
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub
    Protected WithEvents Label1 As System.Web.UI.WebControls.Label
    Protected WithEvents lblErr As System.Web.UI.WebControls.Label
    Protected WithEvents tdReturn As System.Web.UI.HtmlControls.HtmlTableRow
    Protected WithEvents tdClose As System.Web.UI.HtmlControls.HtmlTableRow

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Protected WithEvents Header1 As Header
    Protected WithEvents Footer1 As Footer

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        If Not Me.IsPostBack Then
            If Request.Url.AbsolutePath.IndexOf("Dialog") > 0 Then
                ' come from a dialog page, hide header and footer
                Header1.Visible = False
                Footer1.Visible = False
                Me.tdClose.Visible = True
                Me.tdReturn.Visible = False
            Else
                Me.tdClose.Visible = False
                Me.tdReturn.Visible = True                
            End If

            Dim messErr As String = Server.GetLastError.Message
            messErr = messErr.Substring(messErr.IndexOf("=") + 1, messErr.LastIndexOf(")") - messErr.IndexOf("=") - 1)
            lblErr.Text = Server.HtmlEncode(messErr)
        End If
    End Sub

End Class
